// JavaScript Document
var collection = {
	list: function (categroyId, areaCode, auctionType, auctionStatus, orderField, orderDirection, keyword, pageNum, pageSize) {
		var data = {
			categroyId: categroyId,//分类ID
			areaCode: areaCode,//地区编号
			auctionType: auctionType,//竞拍方式
			auctionStatus: auctionStatus,//竞拍状态
			orderField: orderField,//排序字段
			orderDirection: orderDirection,//还需方式
			keyword: keyword,//查询关键字
			pageNum: pageNum,//页码
			pageSize: pageSize//每页条数
		};
		$.commonAjax({
			url: 'B054',
			type: 'POST',
			data: data,
			isShowError: true,
			success: function (res) {
				var htm = '';
				$.each(res.data.data, function (k, v) {
					console.log(v);
					htm += '<li id="del_+' + v.code + '" class="bond-list">';
					htm += '    <div class="bondImg">';
					htm += '        <img src="' + CONFIG.imgUrl + v.goods.iconImages.mediumUrl + '" alt="">';
					htm += '    </div>';
					htm += '    <div class="bondInfo">';
					htm += '        <div class="bondTit">' + v.name + '</div>';
					htm += '        <div class="closeMoney">当前价：<span>￥' + v.reservePrice + '</span></div>';
					htm += '        <div class="startTime">开始时间：' + bp.timestamp_to_date(Number(v.endTime)) + '</div>';
					htm += '        <div class="endTime">结束时间：' + bp.timestamp_to_date(Number(v.endTime)) + '</div>';
					htm += '    </div>';
					htm += '    <div class="detailsBtn">';
					htm += '        <div onClick="bp.jump_data(\'details.html?goodsCode=' + v.goods.code + '\')" class="details"></div>';
					htm += '        <div onClick="collection.delet(\'' + v.code + '\',this)" class="remove"></div>';
					htm += '    </div>';
					htm += '</li>';
				})
				$('.bond-box').html(htm);
			}, error: function (res) {
				$.layermsg(res.msg);
			}
		});
	}, delet: function (auctionCode, obj) {
		console.log(auctionCode);//	
		var data = { auctionCode: auctionCode }
		$.commonAjax({
			url: 'B050',
			type: 'POST',
			data: data,
			isShowError: true,
			success: function (res) {
				$.layermsg('删除' + res.msg);
				$(obj).parent().parent().remove()

			}, error: function (res) {
				$.layermsg(res.msg);
			}
		});
	}
}
$(function () {
	collection.list();
})